#!/usr/bin/env php
<?php
/**
 * 一个开发工具
 *
 * @version        2019年6月5日 tianya $
 * @package        DedeBIZ.Command
 * @copyright      Copyright (c) 2020, DedeBIZ.COM
 * @license        https://www.dedebiz.com/license
 * @link           https://www.dedebiz.com
 */
// 切换工作目录到./src
$workDir = dirname(__FILE__) . "/src";
chdir($workDir);

if (substr(php_sapi_name(), 0, 3) === 'cgi') {
	die("DedeCMSV6:needs php-cli to run\n\n");
}

if (count($argv) > 1 && $argv[1] == "serv") {
	// PHP5.4以下不支持内建服务器
	// 用于开发调试
	if (phpversion() < "5.4") {
		die("DedeCMSV6:command web server not support\n\n");
	}
	echo "Start Dev Server For DedeCMSV6\n\r";
	echo "Open http://localhost:8088\n\r";
	passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./'));
}
